package com.xiaoy.util.json;

import java.util.List;

import org.springside.modules.orm.Page;
import com.google.common.collect.Lists;
import com.xiaoy.page.PageWrapper;

/**
 * JSON工具类
 * 用于json格式对象和java对象的数据转换
 * @author chentianyi
 *  未测试多线程
 */

public class JSONUtils{
	
	public static IJsonBeanMapper mapper = JacksonMapperImpl.nonEmptyMapper();
	
	public static String toJson(Object object) {
		return mapper.toJson(object);
	}
	
	public static<X> X fromJson(String jsonString, Class<X> clazz) {
		return mapper.fromJson(jsonString, clazz);
	}
	
	public static<X> List<X> json2Map(String jsonString, Class<X> pojoClass) {
		
		return mapper.json2Map(jsonString, pojoClass);
	}
	
	public static <X> List<X> json2List(String jsonString, Class<X> pojoClass) {
		return mapper.json2Map(jsonString, pojoClass);
	}
	

}